package com.pac.weixin.util;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.kuanrf.commons.weixin.api.WxService;
import com.kuanrf.commons.weixin.api.help.WxReceiveMsgHandler;
import com.kuanrf.commons.weixin.exception.WxErrorException;
import com.kuanrf.commons.weixin.msg.bean.WxMsg;
import com.kuanrf.commons.weixin.msg.reply.bean.BaseReplyMsg;
import com.kuanrf.commons.weixin.msg.reply.bean.ReplyImageMsg;
import com.pac.weixin.service.WxChatService;

/**
 * 微信消息处理类
 * 
 * @author lujun.chen
 * @version [版本号, 2015年4月3日]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
@Component
public class WxReceiveMHandler implements WxReceiveMsgHandler {

	@Autowired
	private WxChatService wxChatService;

	/** 图片消息处理 */

	@Override
	public BaseReplyMsg image(WxMsg wxMsg, Map<String, Object> map,
			WxService wxService) throws WxErrorException {
		wxChatService.addChatImgFromWx(wxMsg);

		ReplyImageMsg m = BaseReplyMsg.IMAGE().mediaId("").replyUser(wxMsg)
				.build();
		return m;
	}

	/** 链接消息处理 */

	@Override
	public BaseReplyMsg link(WxMsg wxMsg, Map<String, Object> map,
			WxService wxService) {
		// TODO Auto-generated method stub
		return null;
	}

	/** 地理位置信息消息处理 */

	@Override
	public BaseReplyMsg location(WxMsg wxMsg, Map<String, Object> map,
			WxService wxService) {
		// TODO Auto-generated method stub
		return null;
	}

	/** 段视频消息处理 */

	@Override
	public BaseReplyMsg shortvideo(WxMsg wxMsg, Map<String, Object> map,
			WxService wxService) {
		// TODO Auto-generated method stub
		return null;
	}

	/** 文本消息处理 */

	@Override
	public BaseReplyMsg text(WxMsg wxMsg, Map<String, Object> map,
			WxService wxService) throws WxErrorException {
		wxChatService.addChatFromWx(wxMsg);
//		ReplyTextMsg m = BaseReplyMsg.TEXT().content("")
//				.replyUser(wxMsg).build();
		return null;
	}

	/** 消息转发处理 */

	@Override
	public BaseReplyMsg transfer(WxMsg wxMsg, Map<String, Object> map,
			WxService wxService) {
		// TODO Auto-generated method stub
		return null;
	}

	/** 视频消息处理 */

	@Override
	public BaseReplyMsg video(WxMsg wxMsg, Map<String, Object> map,
			WxService wxService) {
		// TODO Auto-generated method stub
		return null;
	}

	/** 语音消息处理 */

	@Override
	public BaseReplyMsg voice(WxMsg wxMsg, Map<String, Object> map,
			WxService wxService) {
		// TODO Auto-generated method stub
		return null;
	}

}
